<?php 
	//----------------------------------------------
	//               项目登陆页面
	//----------------------------------------------
	
	//处理登陆页面
	if(isset($_POST['dosubmit'])){
		//加载MySQL数据库连接配置页面
		include "conn.inc.php";

		$sql = "select id, username, allow_1, allow_2, allow_3 from user where username = ? and password = ?";
		$stmt = $pdo->prepare($sql);
		$stmt -> execute(array($_POST['username'], $_POST['password']));

		//判断是不是登陆成功
		if($stmt->rowCount() > 0){

			//将用户信息一次性存入session中去
			$_SESSION = $stmt->fetch(PDO::FETCH_ASSOC);

			//加登陆标记
			$_SESSION['islogin'] = 1;

			//跳转页面
			header("Location:index.php");

		}else{
			echo "登录失败<br>";
		}
	}
	


 ?>
 <form action="login.php" method="post">
 	UserName:<input type="text" name="username"><br>
 	PassWord:<input type="password" name="password"><br>
 	<input type="submit" name="dosubmit" value="Login" />
 </form>